<input type="hidden" name="id" value="{{ $product->id ?? '' }}" />
{{--<div class="layui-form-item">
    <label for="" class="layui-form-label">分类</label>
    <div class="layui-input-inline">
        --}}{{--todo    可以直接添加栏目--}}{{--
        <select name="cate_id">
            @foreach($cates as $cate)
                <option value="{{ $cate->id }}" @if(isset($product->cate_id)&&$product->cate_id==$cate->id)selected @endif >{{ $cate->name }}</option>
            @endforeach
        </select>
    </div>
</div>--}}

<div class="layui-form-item">
    <label for="" class="layui-form-label">名称</label>
    <div class="layui-input-block">
        <input type="text" name="title" value="{{$product->title??''}}" lay-verify="required" placeholder="请输入商品名称" class="layui-input" >
    </div>
</div>

<div class="layui-form-item">
    <label for="" class="layui-form-label">规格设置</label>
    <div class="layui-input-block">
        <div id="toolbar">
            <div>
                <button type="button" class="layui-btn layui-btn-sm" data-type="addRow" title="添加一行">
                    <i class="layui-icon layui-icon-add-1"></i> 添加一行
                </button>
            </div>
        </div>
        <div id="tableRes" class="table-overlay">
            <table id="dataTable" lay-filter="dataTable" class="layui-hide"></table>
        </div>
    </div>
</div>

<div class="layui-form-item">
    <label for="" class="layui-form-label">商家介绍</label>
    <div class="layui-input-block">
        <input type="text" name="store_description" lay-verify="required" value="{{$product->store_description??''}}" placeholder="请输入商家介绍" class="layui-input" >
    </div>
</div>
{{--todo    可以做成单选--}}
<div class="layui-form-item">
    <label class="layui-form-label">秒杀时间段</label>
    <div class="layui-input-inline">
        <input type="text" class="layui-input" name="miaosha_start" id="miaosha_start" placeholder="开始时间" value="{{ $product->miaosha_start ?? ''}}">
    </div>
    <div class="layui-input-inline">
        <input type="text" class="layui-input" name="miaosha_end" id="miaosha_end" placeholder="结束时间" value="{{ $product->miaosha_end ?? ''}}">
    </div>
    <label class="layui-form-label">仅秒杀商品</label>
</div>
<div class="layui-form-item">
    <label for="" class="layui-form-label">秒杀置顶</label>
    <div class="layui-input-inline">
        <input type="number" class="layui-input" name="miaosha_top" placeholder="数字越大越靠前" value="{{ $product->miaosha_top ?? '' }}">
    </div>
    <label class="layui-form-label">0为不置顶</label>
</div>
{{--todo    实现单选效果--}}
<div class="layui-form-item">
    <div class="layui-inline">
        <label for="" class="layui-form-label">核销方式</label>
        <div class="layui-input-block">
            <input type="radio" name="hexiao_type" value="1" title="到店核销" @if(@isset($product->hexiao_type) && $product->hexiao_type==1)checked @endif />
            <input type="radio" name="hexiao_type" value="2" title="物流快递" @if(@isset($product->hexiao_type) && $product->hexiao_type==2)checked @endif />
        </div>
    </div>
    <div class="layui-inline">
        <label class="layui-form-label">截止时间</label>
        <div class="layui-input-inline">
            <input type="text" name="hexiao_end" id="hexiao_end" class="layui-input" placeholder="核销截止时间" value="{{ $product->hexiao_end ?? '' }}">
        </div>
    </div>
    <div class="layui-inline">
        <label class="layui-form-label">核销手机号</label>
        <div class="layui-input-inline">
            <input type="number" id="hexiao_mobile" name="hexiao_mobile" class="layui-input" value="{{ $product->hexiao_mobile ?? '' }}">
        </div>
    </div>
</div>

<div class="layui-form-item">
    <label for="" class="layui-form-label">缩略图</label>
    <div class="layui-input-block">
        <div class="layui-upload">
            <button type="button" class="layui-btn layui-btn-sm uploadPic"><i class="layui-icon">&#xe67c;</i>缩略图上传</button>
            <div class="layui-upload-list" >
                <ul class="layui-upload-box layui-clear">
                    @if(isset($product->cover))
                        <li><img src="{{ $product->cover }}" /><p>上传成功</p></li>
                    @endif
                </ul>
                <input type="hidden" name="cover" class="layui-upload-input" lay-verify="required" value="{{ $product->cover ?? '' }}">
            </div>
        </div>
    </div>
</div>
{{--todo 删除已经上传的图片 、图片排序--}}
<div class="layui-form-item">
    <label for="" class="layui-form-label">轮播图</label>
    <div class="layui-input-block">
        <div class="layui-upload">
            <button type="button" class="layui-btn" id="imagesUpload">轮播图上传</button>
            <blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;overflow: auto">
                预览图：
                <div class="layui-upload-list" id="imagesList">
                    @if(@isset($product) && $product->images)
                        @foreach($product->images as $image)
                        <li>
                            <a href="javascript:;" class="delete-images" title="删除">x</a>
                            <img src="{{$image}}" />
                            <p>上传成功</p>
                            <input type="hidden" name="images[]" value="{{$image}}" />
                        </li>
                        @endforeach
                    @endif
                </div>
            </blockquote>
        </div>
    </div>
</div>

<div class="layui-form-item">
    <label for="" class="layui-form-label">详情长图</label>
    <div class="layui-input-block">
        <div class="layui-upload">
            <button type="button" class="layui-btn layui-btn-sm uploadDetail"><i class="layui-icon">&#xe67c;</i>长图上传</button>
            <div class="layui-upload-list" >
                <ul class="layui-upload-box layui-clear detailImage">
                    @if(isset($product->detail_image))
                        <li><img src="{{ $product->detail_image }}" /><p>上传成功</p></li>
                    @endif
                </ul>
                <input type="hidden" name="detail_image" class="layui-upload-input" lay-verify="required" value="{{ $product->detail_image??'' }}">
            </div>
        </div>
    </div>
</div>

{{--todo分润大于0--}}
<div class="layui-form-item">
    <label for="" class="layui-form-label">分润设置</label>
    <div class="layui-inline">
        <div class="layui-input-inline">
            <input type="number" name="p_rate" class="layui-input" placeholder="一级分润" value="{{ $product->p_rate ?? '' }}">
        </div>
        <label class="layui-form-label" style="text-align: left">%</label>
        <div class="layui-input-inline">
            <input type="number" name="p_p_rate" class="layui-input" placeholder="二级分润" value="{{ $product->p_p_rate ?? '' }}">
        </div>
        <label class="layui-form-label" style="text-align: left">%</label>
    </div>
</div>

<div class="layui-form-item">
    <label for="" class="layui-form-label">排序</label>
    <div class="layui-input-inline">
        <input type="number" class="layui-input" name="sort" placeholder="数字越大越靠前，可不填。" value="{{ $product->sort ?? 0 }}">
    </div>
</div>

<div class="layui-form-item">
    <div class="layui-input-block">
        <button type="button" class="layui-btn" lay-submit="" lay-filter="productC">确 认</button>
        <a class="layui-btn" href="{{route('product.index')}}" >返 回</a>
    </div>
</div>

<style>
    #imagesList {
        flex: 1;
    }
    #imagesList li {
        float: left;
        margin-right: 5px;
    }
    #imagesList li img {
        width: 200px;
    }

    /*layer弹层标题居中*/
    .layui-layer-title{
        text-align: center;
    }
</style>

